package com.cxh.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Properties;


public class Param {
	//8.0系统的抄表册上传
	private String enesysUploadMeterReadingTaskUrl;
	//计费试算
	private String billingTestUrl;

	private static Param param;
	
	static Properties properties = new Properties();
	
	public static String transfor(String param) throws UnsupportedEncodingException{
		return new String(param.getBytes("ISO8859-1"),"UTF-8");
	}
	
	public static void loadPropertiesFromSrc() {
		InputStream in = Param.class.getResourceAsStream("/param.properties");
		try {
			properties.load(in);
			param = Param.getParam();
			param.setEnesysUploadMeterReadingTaskUrl(transfor((String)properties.getProperty("enesysUploadMeterReadingTaskUrl")));
			param.setBillingTestUrl(transfor((String)properties.getProperty("billingTestUrl")));
		} catch (IOException e) {
			LogUtil.exception(e);
			e.printStackTrace();
		}
	}
	public static void main(String[] args) throws IOException {
		InputStream in = Param.class.getResourceAsStream("/param.properties");
		properties.load(in);
		String value = new String(((String)properties.get("makeInvoiceUrl")).getBytes("ISO8859-1"), "UTF-8");
		System.out.println(value);
	}

	public static Param getParam() {
		if(param==null){
			param = new Param();
		}
		return param;
	}

	public String getEnesysUploadMeterReadingTaskUrl() {
		return enesysUploadMeterReadingTaskUrl;
	}

	public void setEnesysUploadMeterReadingTaskUrl(String enesysUploadMeterReadingTaskUrl) {
		this.enesysUploadMeterReadingTaskUrl = enesysUploadMeterReadingTaskUrl;
	}

	public String getBillingTestUrl() {
		return billingTestUrl;
	}

	public void setBillingTestUrl(String billingTestUrl) {
		this.billingTestUrl = billingTestUrl;
	}
}